package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.viewInterface.UiInterface;

/**
 * author : 许建宏
 * Date: 2017/11/29 0029
 * View:患者信息单项提交
 */

public class AloneUserPresenter {

    private RequestModel requestModel;
    private UiInterface<DataStateResult> uiInterface;

    public AloneUserPresenter(UiInterface<DataStateResult> uiInterface){
        this.requestModel=new RequestModel();
        this.uiInterface=uiInterface;
    }

    public void AloneUserData(String rowName,String content,String tableName){
        requestModel.SubmitAloneUserInformationData(rowName, content,tableName,new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                uiInterface.onViewSuccess(data);
            }

            @Override
            public void onError(String msg) {
                uiInterface.onViewError(msg);
            }

            @Override
            public void onRefreshUI() {
                uiInterface.onViewRefreshUI();
            }
        });
    }
}
